<% if @entries.blank? %>

  <p class="error">There are no entries added yet.</p>

<% else %>

  <table>
    <thead>
      <tr>
        <th>Runner</th>
        <th>Miles</th>
        <th>Sessions</th>
        <th>Date ran</th>
        <th class="last"></th>
      </tr>
    </thead>
    <tbody>
      <% @entries.each do |entry| %>
        <tr class="<%= cycle('odd', 'even') %>">
          <td><%= link_to h(entry.runner.name), entry.runner %></td>
          <td><%= link_to entry.distance, entry %></td>
          <td><%= entry.sessions %></td>
          <td><%= entry.date%></td>
          <td class="last">
            <%= link_to(image_tag('icons/pencil.png', :alt => 'Edit'), edit_entry_path(entry)) %>
            <%= link_to(image_tag('icons/cross.png', :alt => 'Delete'), entry, :confirm => 'Are you sure?', :method => :delete) %>
          </td>
        </tr>
      <% end %>
    </tbody>
  </table>

<% end %>
<%if @runner%>
<p><%= link_to 'New entry', {:controller => "entries", :action => "new", :runner_id => @runner.id} %></p>
<%else%>
<p><%= link_to 'New entry', {:controller => "entries", :action => "new"} %></p>
<%end%>